from likeshop_api_project.api.login_api import login_model
from likeshop_api_project.base.mybase import Tools


# 购物车选中状态
class cart_status_model(Tools):
    path = '/api/cart/selected'

    def cart_status_action(self, cart_id, selected, hd):
        cart_status_data = {
            "cart_id": cart_id,
            "selected": selected,
        }
        shop_status = self.huihua.post(url=self.hosturl+self.path, data=cart_status_data, headers=hd)
        return shop_status.json()



import requests
s = requests.session()
reg = login_model(huihua=s)
msg = reg.login_action(account="13356786546", password="rr98765", client=2)
# print(msg)
get_token = msg["data"]["token"]
# print(get_token)
hd = {"token": get_token}


cart_status = cart_status_model(huihua=s)
msg = cart_status.cart_status_action(cart_id=270, selected=1, hd=hd)
print(msg)

# shop_cart = shop_cart_model(huihua=s)
# msg = shop_cart.shop_cart_action(hd=hd)
# print(msg)
# get_cardid = msg["data"]["lists"][0]["cart_id"]
# print(get_cardid)